<?php

include_once("../functions_for_filter.php");

// 建立数据库连接 
$db_name = "filter_words";
$dbcnx = connect_db($db_name);
$suffix_array = array ("d", "ed", "eer", "eest", "eing", "er", "est", "ied", "ier", "ies", "iest", "ily", "irr", "ly", "es", "ing", "prototype", "s");

$level_array = array();
$leveled_data = array();
for ($index = 1; $index <= 6; $index++)
{
	//遍历同一难度级别的所有表，将表中的单词存入到数组level_array
	for ($i = 0; $i < sizeof ($suffix_array); $i++)
	{
		$sql = "select * from level" .$index. "_words_" .$suffix_array[$i]. ";";
		$result = mysql_query($sql);
		while ( $row = mysql_fetch_array($result, MYSQL_BOTH) )
		{
			//词库里的单词是不重复的
			$level_array[$row["word"]] = $index;
		}
	}
	echo $index . " " . count($level_array) . "\n";
	unset ($level_array);
}
mysql_close ($dbcnx);

?>

